package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

@Getter
@Setter
public class Store extends BaseDomain{
    public static final int STATE_FORBIDDEN = 0;//下架
    public static final int STATE_RECOMMEND = 1;//上架
    private String name;//名字

    private String introduce;//商品介绍

    private String coverUrl;//商品封面

    private Integer score;//所需积分

    private Integer state = STATE_RECOMMEND;//状态

    public String getJson() {
        HashMap<Object, Object> map = new HashMap<Object, Object>();
        map.put("id",id);
        map.put("name",name);
        map.put("introduce",introduce);
        map.put("coverUrl",coverUrl);
        map.put("score",score);
        map.put("state", state);
        return JSONUtil.toJSONString(map);
    }

    public String getStateName() {
        String msg = "上架";
        if (state == STATE_FORBIDDEN) {
            msg = "下架";
        }
        return msg;
    }
}